import {reactive,onMounted,onBeforeUnmount} from 'vue'
export default function(){
    // 获取坐标点相关的数据
    let point = reactive({
        x:0,
        y:0
    })
    //  获取坐标点相关的方法
    function savePoint(event){
        point.x = event.clientX;
        point.y = event.clientY
    }

    // 获取坐标点相关的生命周期钩子
    onMounted(()=>{
        window.addEventListener('click',savePoint)
    })

    onBeforeUnmount(() => {
        window.removeEventListener('click',savePoint)
    })

    return point
}